feat: add Ed25519 and Ed448 algorithms (RFC 9864) - #69
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #69 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 261 290 +29
===========================================
Files 40 44 +4
Lines 578 629 +51
===========================================
+ Hits 578 629 +51 ☔ View full report in Codecov by Harness. |
RFC 9864 deprecates the polymorphic EdDSA identifier in favor of the fully-specified Ed25519 and Ed448 names, which jwt.io now lists. - Ed25519Signer/Ed25519Verifier subclass the EdDsa classes, changing only the JWS alg name; same sodium keys and signatures. - Ed448Signer/Ed448Verifier run on OpenSSL (openssl_sign/openssl_verify with no digest), available since PHP 8.4. The Ed448PrivateKey and Ed448PublicKey classes (PEM path or inline, like RSA/ECDSA keys) gate the algorithm at construction by requiring OPENSSL_KEYTYPE_ED448, so PHP 7.4-8.3 users get a clear InvalidKeyException and everything else keeps working unchanged. - Interop vectors signed with the OpenSSL CLI: sodium verifies an independent Ed25519 implementation (RFC 8037 key), and the Ed448 vector pins the raw 114-byte signature format. - New test keys: ed448-*.pem plus x448-private.pem (loads but cannot sign) for the signing-failure path.
miladrahimi
force-pushed
the
feature/ed25519-ed448
branch
from
August 1, 2026 06:59
7091a2e to
cd1a649
Compare
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Adds the RFC 9864 fully-specified EdDSA algorithm identifiers,
Ed25519andEd448. RFC 9864 deprecates thepolymorphic
EdDSAidentifier in favour of names that pin the curve, and jwt.io now lists both. The existingEdDsa*classes are untouched and keep working.What's included
Ed25519Signer/Ed25519Verifier— subclass theEdDsa*classes and change only the JWSalgname.Same libsodium keys and same signatures, so tokens are interchangeable apart from the header.
Ed448Signer/Ed448Verifier— Curve448 via OpenSSL (openssl_sign/openssl_verifywith digest0),available since PHP 8.4.
Ed448PrivateKey/Ed448PublicKey— PEM path or inline content, like the RSA/ECDSA keys. They requireOPENSSL_KEYTYPE_ED448at construction, so on PHP 7.4–8.3 users get a clearInvalidKeyExceptioninstead ofan obscure OpenSSL failure, and every other algorithm is unaffected.
README,ARCHITECTURE,TESTING,ADDING_AN_ALGORITHM,CONTRIBUTING,CLAUDE.md) and runnableexamples/ed25519.php+examples/ed448.php.Compatibility
No breaking changes and no new runtime dependencies.
Ed25519needsext-sodium(asEdDSAalready did);Ed448needs PHP 8.4+ with OpenSSL Ed448 support and is skipped elsewhere.Testing
Ed25519Test,Ed448Test,Ed448PrivateKeyTest,Ed448PublicKeyTest, plus newExamplesTest/ExamplesScriptsTestcoverage for the README snippets and example scripts.(RFC 8037 key), and the Ed448 vector pins the raw 114-byte signature format.
ed448-private.pem,ed448-public.pem, andx448-private.pem(loads but cannot sign)to cover the signing-failure path.